<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // test()   判断是否存在
        // exec()    找到匹配的内容和子正则的内容   ()就是子正则   返回数组


        const reg = /{{(\w+)(\w+)}}/g;

        console.log(reg.exec('{{hi}}  {{hello}}'));

        console.log(reg.exec('{{hi}}  {{hello}}'));

        console.log(reg.exec('{{hi}}  {{hello}}'));

        console.log(reg.exec('{{hi}}  {{hello}}'));

    </script>

</body>

</html>